SpatialStream® Code Examples

Postal Code Thematic Mapping

Using the Postal Code Boundaries, GetMap, SLD, and Legend SpatialStream® components, you can create dynamic trend maps for your mapping application with your own data or data available through the SpatialStream® Content Library. This example will demonstrate how to create a custom postal code thematic map, apply alternate themes to an existing thematic map with new SLDs and generate a legend image with Legend. The thematic map will display home sales statistics for May 2010, by postal code for Los Angeles County, California.

Creating thematic maps using SpatialStream® has several advantages including performance, ease, and interactivity. SpatialStream® generated thematic maps relieve developers from the task of linking tabular data to spatial data (home sales to postal code boundaries here) and make it easy to define new map styles and trend views with only a new SLD.

Postal Code Boundaries | GetMap | Legend | SLD

// Add the sales layer using a thematic map SLD definition
var la_salesData = new Dmp.Layer.WMSLayer("lasales", "SS", {
antiAlias: true
});
la_salesData.addChild("lasalesPoly", "DMP_LICENSE/lasaledata_SFR_052010", "$(ACCOUNT_FOLDER)SLD/LA_SALES_AVG_PRICE_SOLD.sld.xml", {
zoomRange: {
min: 1, max: 19
}
});
map.addLayer(la_salesData);

//----------------

// Update the SLD for the sales layer
var sld = document.getElementById("sld").value;
var dmpLayer = map.getDmpLayerById("lasales");
dmpLayer.getChildById("lasalesPoly").attr("style", "$(ACCOUNT_FOLDER)SLD/" + sld);
dmpLayer.refresh();


Run Sample   View Video   Back To Index